package com.tcm.controller.backend;

import com.tcm.common.enums.ResponseEnum;
import com.tcm.entity.dto.param.SocialStudentPageParam;
import com.tcm.entity.dto.param.StudentPageParam;
import com.tcm.entity.resp.R;
import com.tcm.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 积分查询模块控制器
 * @author Guqier
 * @version 1.0
 * @date 2023/8/1 16:43
 */
@RestController
@RequestMapping("/pc/score")
public class ScoreController {

    @Autowired
    private ScoreService scoreService;

    /**
     * 获取学生积分查询列表
     * @param param 查询参数
     * @return 学生积分查询列表
     */
    @RequestMapping(value = "/student", method = RequestMethod.GET)
    public R getStudentRankList(StudentPageParam param){
        if (param.getPage() == null || param.getPageSize() == null) {
            return R.fail(ResponseEnum.PARAM_IS_BLANK);
        }
        return R.success(scoreService.getStudentRankList(param));
    }

    /**
     * 获取社会化学员积分查询列表
     * @param param 查询参数
     * @return 社会化学员积分查询列表
     */
    @RequestMapping(value = "/socialStudent", method = RequestMethod.GET)
    public R getSocialStudentRankList(SocialStudentPageParam param){
        if (param.getPage() == null || param.getPageSize() == null) {
            return R.fail(ResponseEnum.PARAM_IS_BLANK);
        }
        return R.success(scoreService.getSocialStudentRankList(param));
    }

}
